import request from '@/utils/request'

/**
 * 查询所有分类信息
 * @returns 
 */
export const getCategoryListService = () => {
    return request.get('/admin/category')
}

/**
 * 分页条件查询分类信息
 * @param {*} dto 
 * @returns 
 */
export const getCategoryListPageService = (dto) => {
    return request.get('/admin/category/page', {
        params: dto
    })
}

/**
 * 新增分类信息
 * @param {*} categoryName 
 * @returns 
 */
export const addCategoryService = (categoryName) => {
    return request.post(`/admin/category/${categoryName}`)
}

/**
 * 批量删除分类数据
 * @param {*} ids 
 * @returns 
 */
export const deleteCategoryService = (ids) => {
    return request.delete('/admin/category', {
        data: ids
    })
}

/**
 * 批量修改分类数据
 * @param {*} dto 
 * @returns 
 */
export const updateBatchService = (dto) => {
    return request.put('/admin/category/status',dto)
}

export const getNameByIdService = (id) => {
    return request.get(`/admin/category/name/${id}`)
}